package demo3;

import java.io.File;
        import java.io.FileFilter;
        import java.io.IOException;
        import java.util.Scanner;

public class Test9 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);



        String name = scanner.nextLine();
        File dir = new File("files/" + name);
        if (!dir.exists()) {
            if (!dir.mkdirs()) {
                System.out.println("文件创建失败！");
                return;
            }
        }

        File file1 = new File(dir, "1.txt");
        File file2 = new File(dir, "2.txt");
        File file3 = new File(dir, "3.java");

        try {
           file1.createNewFile();
            file2.createNewFile();
            file3.createNewFile();



        } catch (IOException e) {
            System.out.println("文件创建失败！");
            return;
        }

        File[] files = dir.listFiles(new FileFilter() {
            @Override
            public boolean accept(File pathname) {
                return pathname.getName().endsWith(".txt");
            }
        });

        if (files == null ) {
            System.out.println("无结果");
        } else {
            for (File file : files) {
                System.out.println(file.getName());
            }
        }
    }
    }
